package com.example.demo.controller;

import com.example.demo.service.DevicePropertyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestParam;

@RestController
@RequestMapping("/api/device-property")
public class DevicePropertyController {

    private final DevicePropertyService devicePropertyService;

    @Autowired
    public DevicePropertyController(DevicePropertyService devicePropertyService) {
        this.devicePropertyService = devicePropertyService;
    }

    @GetMapping("/set")
    public String setDeviceProperty(
            @RequestParam(defaultValue = "1") String relay1,
            @RequestParam(defaultValue = "1") String relay2) {
        return devicePropertyService.setDeviceProperty(relay1, relay2);
    }
}